<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    function getVal() {
      let elementById = document.getElementById("sp2");
      alert(elementById.innerText);
      alert(elementById.innerHTML);
    }
    function setVal() {
      let byId = document.getElementById("sp1");
      byId.innerText="<font color='red'>于飞正</font>";
      byId.innerHTML="<font color='red'>于飞正</font>";
    }
  </script>
</head>
<body>
<span id="sp1">佑我中华</span><br />
<span id="sp2"><font color="red">佑我中华</font></span><br />
<input type="button" value="获取标签体的内容" onclick="getVal()"/>
<input type="button" value="设置标签体的内容" onclick="setVal()"/>
</body>
</html>